﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.Infrastructure;
using DLM.Domain.Model;

namespace DLM.Data.EF.CodeFirst.Mapping
{
    public class AccountMap : EntityTypeConfiguration<Account>
    {
        public AccountMap()
        {
            this.HasKey(t => t.AccountID);
            this.ToTable("Account");

            this.Property(t => t.AccountID).HasColumnName("AccountID");
            this.Property(t => t.AccountName).HasColumnName("AccountName").IsRequired().HasMaxLength(25);
            this.Property(t => t.Password).HasColumnName("Password").IsRequired().IsUnicode(false);
            this.Property(t => t.Email).HasColumnName("Email").IsRequired().IsUnicode(false).HasMaxLength(30);
            this.Property(t => t.ActiveCode).HasColumnName("ActiveCode").IsRequired().IsUnicode(false).HasMaxLength(50);
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.IsValidation).HasColumnName("IsValidation");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
        }
    }
}
